﻿Imports Microsoft.VisualBasic
Imports System.Collections.Generic
Imports System.Linq
Namespace OneCall.User
    Public Module Subscription
        Public Function isSubscribed(UserID As Integer, SubscriptionId As Integer) As Boolean
            Dim ret As Boolean = False
            Dim SQLDB As New OneCall.DataModel.OneCDataEntities
            Dim curCust As List(Of OneCall.DataModel.Membership) = (From p In SQLDB.Memberships Where p.Membership_Customer_ID = UserID And p.Membership_Subscription_ID = SubscriptionId).ToList()
            If (curCust.Count >= 1) Then
                ret = True
            End If
            SQLDB.Dispose()
            Return ret
        End Function
    End Module
    Public Class UserSubscription
        Public StartDate As DateTime
        Public EndDate As DateTime

        Public Sub New(UserID As Integer, SubscriptionId As Integer)
            Dim SQLDB As New OneCall.DataModel.OneCDataEntities
            Dim curCust As List(Of OneCall.DataModel.Membership) = (From p In SQLDB.Memberships Where p.Membership_Customer_ID = UserID And p.Membership_Subscription_ID = SubscriptionId).ToList()
            If (curCust.Count >= 1) Then
                StartDate = curCust(0).Membership_StartDate
                EndDate = curCust(0).Membership_EndDate
            End If
            SQLDB.Dispose()
        End Sub
    End Class
End Namespace



